export class AudioVisualRules {
  private ini: any;
  private ambientChangeRate: number = 0;
  private ambientChangeStep: number = 0;
  private behind: string = '';
  private bridgeExplosions: string[] = [];
  private chronoBeamColor: number[] = [];
  private chronoBlast: string = '';
  private chronoBlastDest: string = '';
  private chronoPlacement: string = '';
  private chronoSparkle1: string = '';
  private conditionRed: number = 0;
  private conditionYellow: number = 0;
  private creditTicks: string[] = [];
  private extraAircraftLight: number = 0;
  private extraInfantryLight: number = 0;
  private extraUnitLight: number = 0;
  private fireNames: string[] = [];
  private flyerHelper: string = '';
  private gravity: number = 0;
  private idleActionFrequency: number = 0;
  private impactLandSound?: string;
  private impactWaterSound?: string;
  private infantryExplode: string = '';
  private flamingInfantry: string = '';
  private infantryHeadPop: string = '';
  private infantryNuked: string = '';
  private ironCurtainInvokeAnim: string = '';
  private messageDuration: number = 10;
  private metallicDebris: string[] = [];
  private nukeTakeOff: string = '';
  private deadBodies: string[] = [];
  private wake: string = '';
  private parachute: string = '';
  private moveFlash: string = '';
  private warpOut: string = '';
  private warpAway: string = '';
  private weaponNullifyAnim: string = '';
  private weatherConClouds: string[] = [];
  private weatherConBoltExplosion: string = '';
  private weatherConBolts: string[] = [];

  readIni(ini: any): AudioVisualRules {
    this.ini = ini;
    this.ambientChangeRate = ini.getNumber("AmbientChangeRate");
    this.ambientChangeStep = ini.getNumber("AmbientChangeStep");
    this.behind = ini.getString("Behind");
    this.bridgeExplosions = ini.getArray("BridgeExplosions");
    this.chronoBeamColor = ini.getNumberArray("ChronoBeamColor");
    this.chronoBlast = ini.getString("ChronoBlast");
    this.chronoBlastDest = ini.getString("ChronoBlastDest");
    this.chronoPlacement = ini.getString("ChronoPlacement");
    this.chronoSparkle1 = ini.getString("ChronoSparkle1");
    this.conditionRed = ini.getNumber("ConditionRed");
    this.conditionYellow = ini.getNumber("ConditionYellow");
    this.creditTicks = ini.getArray("CreditTicks");
    this.extraAircraftLight = ini.getNumber("ExtraAircraftLight");
    this.extraInfantryLight = ini.getNumber("ExtraInfantryLight");
    this.extraUnitLight = ini.getNumber("ExtraUnitLight");

    let damageFireTypes = ini.getString("DamageFireTypes");
    damageFireTypes = damageFireTypes || "FIRE01,FIRE02,FIRE03";
    this.fireNames = damageFireTypes.split(/\.|,/).filter((e) => e !== "");

    this.flyerHelper = ini.getString("FlyerHelper");
    this.gravity = ini.getNumber("Gravity");
    this.idleActionFrequency = 60 * ini.getNumber("IdleActionFrequency");
    this.impactLandSound = ini.getString("ImpactLandSound") || undefined;
    this.impactWaterSound = ini.getString("ImpactWaterSound") || undefined;
    this.infantryExplode = ini.getString("InfantryExplode");
    this.flamingInfantry = ini.getString("FlamingInfantry");
    this.infantryHeadPop = ini.getString("InfantryHeadPop");
    this.infantryNuked = ini.getString("InfantryNuked");
    this.ironCurtainInvokeAnim = ini.getString("IronCurtainInvokeAnim");
    this.messageDuration = ini.getNumber("MessageDuration", 10);
    this.metallicDebris = ini.getArray("MetallicDebris");
    this.nukeTakeOff = ini.getString("NukeTakeOff");
    this.deadBodies = ini.getArray("DeadBodies");
    this.wake = ini.getString("Wake");
    this.parachute = ini.getString("Parachute");
    this.moveFlash = ini.getString("MoveFlash");
    this.warpOut = ini.getString("WarpOut");
    this.warpAway = ini.getString("WarpAway");
    this.weaponNullifyAnim = ini.getString("WeaponNullifyAnim");
    this.weatherConClouds = ini.getArray("WeatherConClouds");
    this.weatherConBoltExplosion = ini.getString("WeatherConBoltExplosion");
    this.weatherConBolts = ini.getArray("WeatherConBolts");

    return this;
  }
}